#include<iostream>
#include<signal.h>
#include<unistd.h>

void sigcb(int signal)
{
    std::cout << "触发信号" << std::endl;
    exit(0);
}

int main()
{
    signal(SIGINT, sigcb);
    
    while (true)
    {
        std::cout << "pid: " << getpid() << std::endl;
    }

    return 0;
}
